package com.jeff.tianti.cms.dao;

import com.jeff.tianti.cms.dto.font.JobTo;
import com.jeff.tianti.cms.entity.Job;
import com.jeff.tianti.cms.entity.Resume;
import com.jeff.tianti.common.dao.CommonDao;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author liuyi
 * @desc JobDao接口 
 * @date 2019-06-28
 */
public interface JobDao extends JobDaoCustom,CommonDao<Job,String>{
    @Query(" from Job j where (?1 is null or j.publishType = ?1) and (?2 is null or j.areaId = ?2) and (?3 is null  or j.jobType = ?3) and j.auditFlag = 2 and j.deleteFlag=0 ")
    Page<Job> findAllNoDel(String publishType, String areaId, String jobType, Pageable pageable);

    @Query(nativeQuery = true,value = " select j2.* FROM job_resume_middle j1,job j2 WHERE  j1.`job_id` = j2.`id` AND j2.`delete_flag` = 0 AND j2.`audit_flag`=2  AND j1.`uid` = ?1 ")
    List<Job> findByUidAndPage(String uid);
}